# tmux.conf@oblivion

set -g default-terminal "screen-256color" # colors!
setw -g xterm-keys on
set -s escape-time 1                      # faster command sequences
set -sg repeat-time 300                   # increase repeat timeout
set -s focus-events on
set -q -g status-utf8 on                  # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
set -g history-limit 5000                 # boost history

# reload configuration
bind r source-file ~/.tmux.conf \; display 'config reloaded'

# display
setw -g automatic-rename on   # rename window to reflect current program
set -g renumber-windows on    # renumber windows when a window is closed
set -g set-titles on          # set terminal title
set -g set-titles-string 'tmux #S.#I.#P #W '
set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000      # slightly longer status messages display time
# set -g status-interval 10     # redraw status line every 10 seconds

# activity
set -g monitor-activity on
set -g visual-activity off

# create session
bind C-c new-session

# find session
bind C-f command-prompt -p find-session "switch-client -t %%"

# change session directory to the directory of the current pane
# bind d attach-session -t . -c '#{pane_current_path}' \; display 'Changed session directory'

# split current window horizontally
bind s split-window -v
# split current window vertically
bind v split-window -h

bind b set-option -g status

# pane navigation
bind -r h select-pane -L  # move left
bind -r j select-pane -D  # move down
bind -r k select-pane -U  # move up
bind -r l select-pane -R  # move right
bind < swap-pane -D       # swap current pane with the next one
bind > swap-pane -U       # swap current pane with the previous one
bind Space next-layout    # toggle layout

# pane resizing
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5

bind Tab last-window        # move to last active window

# mouse
setw -g mouse on

# setup 'v' to begin selection as in Vim
set-window-option -g mode-keys vi
bind Enter copy-mode
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'

# colors
set -g pane-border-style fg="#444444"
set -g pane-active-border-style fg="#ffffff"

# set -g status-style bg="#111111"
# set -g status-style fg="#555555"
# set -g window-status-current-style bg="#111111"
# set -g window-status-current-style fg="#ffffff"

set -g status on
set -g status-left ''
set -g status-right ''
set-option -g status-position bottom
